# def hanoi(n,x,y,z):
#     if n == 1:
#         print(x,'-->',z)
#
#     else:
#         hanoi(n-1,x,z,y)
#         print(x,'-->',z)
#         hanoi(n-1,y,x,z)
#
# n=int(input('请输入汉诺塔的层数：'))
# hanoi(n,'X','Y','Z')
def tobin(x):
    bin2=''
    if x ==0:
        return '0'
    elif x==1:
        return '1'
    else:
        while x>0:
            bin2=(str(tobin(x%2))+bin2)
            x=x//2
    return bin2
print(tobin(254))
sss=tobin(254)
print(type(sss))
list=[]
def get_digits(n):
    if n>0:
        list.insert(0,n%10)
        get_digits(n//10)

get_digits(12345)
print(list)